<script type="text/javascript" src="js/key1.js"></script>
<script type="text/javascript" src="../../js/jquery.watermark.js"></script>
<table id="product-table" class="table table-bordered">
        <tr id="sort-row" data-base-url="/admin_vina/product/all">
            <!--<th></th>-->
            <th>#</th>
            <th data-model="Product" id="product_post_date"><a href="#">Ảnh sản phẩm</a></th>
            <th data-model="Product" id="product_name"><a href="#">Tên sản phẩm</a></th>
            <th data-model="Brand" id="brand_name"><a href="#">Mã SP</a></th>
            <th data-model="Product" id="product_sell_price"><a href="#">Giá bán</a></th>
           
            <th data-model="Catalogue" id="catalogue_name"><a href="#">Tên danh mục</a></th>
            <th data-model="Product" id="product_code"><a href="#">Tên chủng loại</a></th>
            <th data-model="User" id="user_display_name"><a href="#">Khuyến mại(%)</a></th>
            <th data-model="User" id="user_display_name"><a href="#">SP bán chạy</a></th>
            <th>!</th>
        </tr>
<?php
include('../../config.php');
include('../../includes/connect.php');
//echo $_GET['keyword1'];
if($_GET['keyword1']!='')

{

// Kiểm tra dữ liệu đầu vào có tồn tại hay không

    //$keyword = 	trim($_GET['keyword']) ;		// Cắt bỏ khoảng trắng

//	$keyword = mysqli_real_escape_string($dbc, $keyword);	// Lọc các ký tự đặc biệt

	// Câu query lấy dữ liệu

//	$query = "SELECT * FROM `tbl_thanhvien` WHERE `trinhdo` like '%$keyword%' or `hinhanh` like '%$keyword%' or `gioitinh` like '%$keyword%' or `tuoi` like '%$keyword%' or `tinh` like '%$keyword%'";


			
	// Kết nối Database, thực hiện câu truy vấn
			$sql="SELECT * 

									FROM  `tbl_sanpham` 

									WHERE  `tensp` LIKE  '%".$_GET['keyword1']."%'

									OR  `masp` LIKE  '%".$_GET['keyword1']."%'

									
									ORDER BY `id` DESC";

			$res=mysql_query($sql); 

			while($row=mysql_fetch_array($res)) 

			{
				
				?>
				<tr class=warning>
					<!--<td></td>-->
					<td><?php echo $i++;?></td>
					<td style="width: 90px;"><img src="../uploads/<?php echo $row['anhsp'];?>" style="width:40px; height:40px;"/></td>
					<td><a href="index.php?page=product&act=product_edit&id=<?php echo $row['id']?>"><?php echo $row['tensp'];?></a></td>
                    <td><?php echo $row['masp'];?></td>
					<td style="color: red;"><?php echo $row['gia'];?></td>
					
					<td ><?php echo $row['tendanhmuc'];?></td>
					<td><?php echo $row['tenchungloai'];?></td>
					<td><?php echo $row['khuyenmai'];?></td>
                    <td><?php if($row['banchay']==1){echo 'Sp bán chạy';}else{echo 'Sp mới';};?></td>
					<td>
						<a href="index.php?page=product&act=product_edit&id=<?php echo $row['id'];?>" title="Edit">Sửa</a> |
                             <a href="index.php?page=product&act=product_del&id=<?php echo $row['id'];?>" title="Delete" class="del" style="color: #ff654f">Xóa</a>       |     <a href="index.php?page=product&act=add_img&masp=<?php echo $row['masp'];?>" title="Delete" class="del">Thêm ảnh</a>
					</td>
				 </tr>
               <?php

				}
?>
</table>
<?php
}else{

			echo 'Không tìm thấy!';
}
			   ?>
	</div>
</div>